package com.wdb.modules.system.rest;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wdb.modules.system.domain.User;
import com.wdb.modules.system.domain.vo.UserQueryCriteriaDTO;
import com.wdb.modules.system.service.UserService;
import com.wdb.utils.PageResult;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: wendaobai@qq.com
 * @date: 2024/1/23 0023 15:19
 */
@Api("系统-用户管理")
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/users")
@Slf4j
public class UserController {
  private final UserService userService;

  @GetMapping
  public ResponseEntity<PageResult<User>> queryUser(
      UserQueryCriteriaDTO userQueryCriteria, Page page) {
    log.info("userQueryCriteria-:{}", userQueryCriteria);
    PageResult<User> userPageResult = userService.getAll(userQueryCriteria, page);
    return new ResponseEntity<>(userPageResult, HttpStatus.OK);
  }
}
